import {
	Dimensions,
	ToastAndroid,
	NetInfo,
} from "react-native";

global.gScreen = {
	width: Dimensions.get("window").width,
	height: Dimensions.get("window").height,
}

global.gColor = {
	bgColor1: global.__IOS__ ? "red" : "blue",
	slideBgColor: "#2e3049",
	fontColorOne: "#d8d8db", 
	fontColorTwo: "#67caff",
	fontColorThree: "#83aeff",
	fontColorFour: "#737485",
	fontColorFive: "#fff",
	bgColorOne: "#7892e3",
	bordColorOne: "#f3295f", 
	borderColorTwo: "#f1f1f1",
	bgColorTwo: "#d7d4d4",
	fontColorSix: "#333",
	fontColorSenven: "#e94f4f",
}

global.gFontSize = {
	one: 20,
	two: 16,
	three: 13,
}

//首次打开app时判断网络情况;
global.getNetwork = () => {
	NetInfo.isConnected.fetch().then( isConnected => {
		if(!isConnected) {
			ToastAndroid.show('未连接到网络，请稍后重试!', ToastAndroid.SHORT);
		}
    });
}

//页面刷新时判断网络情况;
global.freshNetwork = () => {
	NetInfo.isConnected.fetch().then( isConnected => {
		if(!isConnected) {
			ToastAndroid.show('网络连接不可用！', ToastAndroid.SHORT);
		}else {
			ToastAndroid.show('为您更新到最新内容！', ToastAndroid.SHORT);
		}
    });
}